package com.qk.mapper;
import com.qk.entity.Course;
import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface CourseMapper {
//1. 课程列表查询
    List<Course> selectlist(String name, Integer subject, Integer target);
//2、添加课程
    @Insert("insert into course(subject,name,price,target,description,create_time,update_time) values(#{subject},#{name},#{price},#{target},#{description},#{createTime},#{updateTime})")
    void insert(Course course);
//3、根据ID查询课程数据
    @Select("select id, subject, name, price, target, description, create_time, update_time from course where id=#{id}")
    Course selectById(Integer id);
//4、修改课程
    @Update("update course set subject=#{subject},name=#{name},price=#{price},target=#{target},description=#{description},update_time=#{updateTime} where id=#{id}")
    void update(Course course);
//5、删除课程
    @Delete("delete from course where id= #{id}")
    void deleteById(Integer id);
//6、查询所有课程
    @Select("select id, subject, name, price, target, description, create_time, update_time from course")
    List<Course> listCourses();
//7、根据课程类别查询课程
  @Select("select id, subject, name, price, target, description, create_time, update_time from course where subject=#{subject}")
    List<Course> getCourseBySubject(Integer subject);
}
